package com.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.List;

/**
 * @Author 杨冰清
 * @Date 20:37
 * @Description 用户信息表
 */

public class User {
    /**
     * 编号
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("id")
    private Integer id;
    /**
     * 名称
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("username")
    private String username;
    /**
     * 密码
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("password")
    private String password;
    /**
     * 电话
     **/
    @JsonProperty("tellphone")
    private String tellPhone;
    /**
     * 个性签名
     **/
    @JsonProperty("personalized_signature")
    private String personalizedSignature;
    /**
     * 角色 1代表用户，2代表管理员
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty("role")
    private Integer role;
    /**
     * 创建时间
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty("creat_time")
    private Date createTime;
    /**
     * 修改时间
     **/
    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonProperty("update_time")
    private Date updateTime;

    //一个用户多个地址
    @JsonInclude(JsonInclude.Include.NON_NULL)
   private List<Address> addresses;

    //一个用户多个购物车条目
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private List<Cart> carts;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public String getTellPhone() {
        return tellPhone;
    }

    public void setTellPhone(String tellPhone) {
        this.tellPhone = tellPhone;
    }

    public String getPersonalizedSignature() {
        return personalizedSignature;
    }

    public void setPersonalizedSignature(String personalizedSignature) {
        this.personalizedSignature =
                personalizedSignature == null ? null : personalizedSignature.trim();
    }

    public Integer getRole() {
        return role;
    }

    public void setRole(Integer role) {
        this.role = role;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public List<Address> getAddresses() {
        return addresses;
    }

    public void setAddresses(List<Address> addresses) {
        this.addresses = addresses;
    }

    public List<Cart> getCarts() {
        return carts;
    }

    public void setCarts(List<Cart> carts) {
        this.carts = carts;
    }
}
